'''
    for循环9*9(1)
'''
for row in range(1,10):
    for col in range(1,row+1):
        print('{}*{}={:<4}'.format(col,row,row*col),end=' ')
    print('')

print('')
print('='*60)

'''
    for循环9*9(2)
'''
for row in range(9,0,-1):
    for col in range(1,row+1):
        print('{}*{}={:<4}'.format(col,row,row*col),end=' ')
    print('')

print('')
print('='*60)

'''
    for循环9*9(3)
'''
for row in range(1, 10):
    for col in range(9, 0, -1):
        if col > row:
            print('         ', end='')
        else:
            print('{}*{}={:<4}'.format(col, row, row * col), end=' ')
    print('')

print('')
print('='*60)

'''
    for循环9*9(4)
'''
for row in range(9, 0, -1):
    for col in range(9, 0, -1):
        if col > row:
            print('         ', end='')
        else:
            print('{}*{}={:<4}'.format(col, row, row * col), end=' ')
    print('')

print('')
print('='*60)

'''
    while循环9*9(1)
'''
row = 1
col = 1
while row < 10:
    while col <= row:
        print('{}*{}={:<4}'.format(col, row, row * col), end=' ')
        col = col + 1
    print('')
    row = row + 1
    col = 1

print('')
print('='*60)

'''
    while循环9*9(2)
'''
row = 9
col = 1
while row > 0:
    while col <= row:
        print('{}*{}={:<4}'.format(col, row, row * col), end=' ')
        col = col + 1
    print('')
    row = row - 1
    col = 1

print('')
print('='*60)

'''
    while循环9*9(3)
'''
row = 1
col = 9
while row < 10:
    while col > 0:
        if col > row:
            print('         ', end='')
        else:
            print('{}*{}={:<4}'.format(col, row, row * col), end=' ')
        col = col - 1
    print('')
    row = row + 1
    col = 9

print('')
print('='*60)

'''
    while循环9*9(4)
'''
row = 9
col = 9
while row > 0:
    while col > 0:
        if col > row:
            print('         ', end='')
        else:
            print('{}*{}={:<4}'.format(col, row, row * col), end=' ')
        col = col - 1
    print('')
    row = row - 1
    col = 9